{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# EntityCharacteristics\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>ConsoleTables, 2.6.1</span></li><li><span>YiJingFramework.EntityRelations, 4.0.1</span></li></ul></div></div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#r \"nuget:ConsoleTables\"\n",
    "#r \"nuget:YiJingFramework.EntityRelations\"\n",
    "using ConsoleTables;\n",
    "using YiJingFramework.EntityRelations.EntityCharacteristics.Extensions;\n",
    "using YiJingFramework.PrimitiveTypes;\n",
    "using YiJingFramework.PrimitiveTypes.GuaWithFixedCount;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`YiJingFramework.EntityRelations.EntityCharacteristics` 命名空间主要提供易学实体的阴阳五行属性。\n",
    "\n",
    "其中，关于八卦会返回如下结果："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "| Gua | Yinyang | Wuxing |\r\n",
      "|-----|---------|--------|\r\n",
      "| 000 | Yin     | Tu     |\r\n",
      "| 001 | Yang    | Tu     |\r\n",
      "| 010 | Yang    | Shui   |\r\n",
      "| 011 | Yin     | Mu     |\r\n",
      "| 100 | Yang    | Mu     |\r\n",
      "| 101 | Yin     | Huo    |\r\n",
      "| 110 | Yin     | Jin    |\r\n",
      "| 111 | Yang    | Jin    |\r\n",
      "\r\n"
     ]
    }
   ],
   "source": [
    "var guaIndexes = Enumerable.Range(0, 8);\n",
    "var table = new ConsoleTable(\"Gua\", \"Yinyang\", \"Wuxing\");\n",
    "foreach (var guaIndex in guaIndexes)\n",
    "{\n",
    "    var gua = GuaTrigram.Parse(guaIndex.ToString(\"b3\"));\n",
    "    table.AddRow(gua, gua.Yinyang(), gua.Wuxing());\n",
    "}\n",
    "table.Write(Format.Minimal);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "关于天干有："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "| Tiangan | Yinyang | Wuxing |\r\n",
      "|---------|---------|--------|\r\n",
      "| Jia     | Yang    | Mu     |\r\n",
      "| Yi      | Yin     | Mu     |\r\n",
      "| Bing    | Yang    | Huo    |\r\n",
      "| Ding    | Yin     | Huo    |\r\n",
      "| Wu      | Yang    | Tu     |\r\n",
      "| Ji      | Yin     | Tu     |\r\n",
      "| Geng    | Yang    | Jin    |\r\n",
      "| Xin     | Yin     | Jin    |\r\n",
      "| Ren     | Yang    | Shui   |\r\n",
      "| Gui     | Yin     | Shui   |\r\n",
      "\r\n"
     ]
    }
   ],
   "source": [
    "var tianganIndexes = Enumerable.Range(1, 10);\n",
    "var table = new ConsoleTable(\"Tiangan\", \"Yinyang\", \"Wuxing\");\n",
    "foreach (var tianganIndex in tianganIndexes)\n",
    "{\n",
    "    var tiangan = Tiangan.FromIndex(tianganIndex);\n",
    "    table.AddRow(tiangan, tiangan.Yinyang(), tiangan.Wuxing());\n",
    "}\n",
    "table.Write(Format.Minimal);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "关于地支有："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "| Dizhi | Yinyang | Wuxing |\r\n",
      "|-------|---------|--------|\r\n",
      "| Zi    | Yang    | Shui   |\r\n",
      "| Chou  | Yin     | Tu     |\r\n",
      "| Yin   | Yang    | Mu     |\r\n",
      "| Mao   | Yin     | Mu     |\r\n",
      "| Chen  | Yang    | Tu     |\r\n",
      "| Si    | Yin     | Huo    |\r\n",
      "| Wu    | Yang    | Huo    |\r\n",
      "| Wei   | Yin     | Tu     |\r\n",
      "| Shen  | Yang    | Jin    |\r\n",
      "| You   | Yin     | Jin    |\r\n",
      "| Xu    | Yang    | Tu     |\r\n",
      "| Hai   | Yin     | Shui   |\r\n",
      "\r\n"
     ]
    }
   ],
   "source": [
    "var dizhiIndexes = Enumerable.Range(1, 12);\n",
    "var table = new ConsoleTable(\"Dizhi\", \"Yinyang\", \"Wuxing\");\n",
    "foreach (var dizhiIndex in dizhiIndexes)\n",
    "{\n",
    "    var dizhi = Dizhi.FromIndex(dizhiIndex);\n",
    "    table.AddRow(dizhi, dizhi.Yinyang(), dizhi.Wuxing());\n",
    "}\n",
    "table.Write(Format.Minimal);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "需要注意，此处地支的阴阳是相互间隔而取。部分情况下，可能使用的不是这一套阴阳。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "file_extension": ".cs",
   "mimetype": "text/x-csharp",
   "name": "python",
   "pygments_lexer": "csharp",
   "version": "3.12.2"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "csharp",
    "items": [
     {
      "aliases": [],
      "name": "csharp"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
